<?php
namespace app\index\model;
use think\Model;

class DeliveryAddress extends Model
{
	// 根据用户ID获取收货地址
	public function getAddrByUid($uid)
	{
		$data = [
			'status' => ['neq',-1],
			'uid' => $uid,	
			];
		return $this->where($data)->select();
	}

	// 根据ID获取收货地址
	public function getAddrById($id)
	{
		$data = [
			'id' => $id,
			'status' => ['neq',-1],
		];
		return $this->where($data)->select();
	}

	// 根据ID删除收货地址
	public function deleteAddrById($id)
	{
		$data = [
			'status' => -1,
		];
		return $this->save($data,['id'=>$id]);
	}
}
